package com.jsyh.maidu.activity.me;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;

import com.jsyh.maidu.R;

public class WebActivity extends Activity {

    WebView wv_ad;
    TextView tv_tetile;
    ImageView iv_back;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web);
        InitView();
    }

    public void InitView ()
    {
        tv_tetile= (TextView) findViewById(R.id.title);
        iv_back= (ImageView) findViewById(R.id.back);
        wv_ad= (WebView) findViewById(R.id.wv_home_ad);
        WebSettings webSettings = wv_ad.getSettings();
        //设置WebView属性，能够执行Javascript脚本
        webSettings.setJavaScriptEnabled(true);
        wv_ad.loadUrl(getIntent().getStringExtra("url"));
        tv_tetile.setText("商品");
        iv_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        //设置Web视图
        wv_ad.setWebViewClient(new webViewClient ());

    }

    //Web视图
    private class webViewClient extends WebViewClient {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    }
}
